import numpy as np
import cvxpy as cp

c = np.array([-20,-10])
a = np.array([[5,4],[2,5]])
b = np.array([24,13])
x = cp.Variable(2,integer = True) #将integer改为false也可以用于求线性规划？
obj = cp.Minimize(c * x)
cons = [a * x <= b, x >= 0]
prob = cp.Problem(obj, cons)
prob.solve(solver = 'GLPK_MI',verbose = True)
print("最优值为：",prob.value)
print("最优解为：",x.value)